/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.GUI;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.TexturePaint;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JTextArea;

/**
 *
 * @author Jelle
 */
public class WaterMarkTextArea extends JTextArea {

    BufferedImage img;

    public WaterMarkTextArea(File file) throws IOException {
        super();
        img=ImageIO.read(file);
        setOpaque(false);
    }

    @Override
    public void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        Rectangle rect = new Rectangle(0, 0, img.getWidth(null), img.getHeight(null));
        g2.setPaint(new TexturePaint(img, rect));
        g.fillRect(0, 0, getWidth(), getHeight());
        super.paintComponent(g);
    }
}
